from abc import ABC, abstractmethod


class ButtonAbstract(ABC):
    """按钮抽象类"""

    @abstractmethod
    def click(self):
        raise NotImplementedError()


class CheckBoxAbstract(ABC):
    """Class description."""

    @abstractmethod
    def check(self):
        raise NotImplementedError()


class WinButton(ButtonAbstract):
    """Class description."""

    def click(self):
        print("win click")


class LinuxButton(ButtonAbstract):
    """Class description."""

    def click(self):
        print("linux click")


class WinCheckbox(CheckBoxAbstract):
    """Class description."""

    def check(self):
        print("win check")


class LinuxCheckbox(CheckBoxAbstract):
    """Class description."""

    def check(self):
        print("linux check")


class GUIFactory(ABC):

    @abstractmethod
    def create_button(self) -> ButtonAbstract:
        raise NotImplementedError()

    @abstractmethod
    def create_checkbox(self) -> CheckBoxAbstract:
        raise NotImplementedError()


class LinuxFactory(GUIFactory):
    """Class description."""

    def create_button(self):
        return LinuxButton()

    def create_checkbox(self):
        return LinuxCheckbox()


class WindowsFactory(GUIFactory):
    """Class description."""

    def create_button(self):
        return WinButton()

    def create_checkbox(self):
        return WinCheckbox()


class MacOSFactory(GUIFactory):
    """Class description."""

    def create_button(self):
        raise NotImplementedError

    def create_checkbox(self):
        raise NotImplementedError


def client_code(factory: GUIFactory) -> None:
    btn = factory.create_button()
    btn.click()
    checkbox = factory.create_checkbox()
    checkbox.check()


def main() -> None:
    client_code(LinuxFactory())
    client_code(WindowsFactory())


if __name__ == "__main__":
    main()
